import {request} from "./request";

export function getUser(data) {
  return request({
    url: '/findAllUser',
    params: data,
    method: 'post'
  })
}
export function getAllUser() {
  return request({
    url: '/findAll',
    method: 'post'
  })
}


export function delUser(account) {
  return request({
    url: '/delUser',
    params: {
      id: account
    },
    method: 'post'
  })
}

export function findUserByName(name) {
  return request({
    url: '/findUserByName',
    params: {
      name: name
    },
    method: 'post'
  })
}

export function findUserByAccount(account) {
  return request({
    url: '/findUserByAccount',
    params: {
      account: account
    },
    method: 'post'
  })
}

export function addUser(form) {
  // console.log(form.name)
  return request({
    url: '/addUser',
    params: {
      name: form.name,
      account: form.account,
      password: form.password,
      sex: form.sex,
      birthday: form.birthday,
      mobile: form.mobile,
      email: form.email,
      mylevel: form.mylevel,
      createTime: form.createTime,
      state: form.state,
      userType: form.userType,
      departmentId: form.departmentId
    },
    method: 'post'
  })
}

export function editUser(form) {
  return request({
    url: '/editUser',
    params: {
      name: form.name,
      account: form.account,
      password: form.password,
      sex: form.sex,
      birthday: form.birthday,
      mobile: form.mobile,
      email: form.email,
      mylevel: form.mylevel,
      createTime: form.createTime,
      state: form.state,
      userType: form.userType,
      departmentId: form.departmentId
    },
    method: 'post'
  })
}

export function getDepartmentId() {
  return request({
    url: '/getDepartmentId',
    method: 'post'
  })
}
